package com.ouc.pampas;

import com.google.common.collect.Maps;
import java.util.Map;

public class BackConfig extends BaseConfig {
	private static final long serialVersionUID = 5571843585899076268L;
	private Map<String, Service> services;

	public String toString() {
		return "BackConfig(services=" + getServices() + ")";
	}

	public Map<String, Service> getServices() {
		return this.services;
	}

	public void setServices(Map<String, Service> services) {
		this.services = services;
	}

	public void merge(BaseConfig config) {
		if (!(config instanceof BackConfig)) {
			throw new IllegalArgumentException("merged config is not BackConfig");
		}
		BackConfig mergedConfig = (BackConfig) config;
		if ((mergedConfig.getServices() != null) && (!mergedConfig.getServices().isEmpty())) {
			if (this.services == null) {
				this.services = Maps.newHashMap();
			}
			this.services.putAll(mergedConfig.getServices());
		}
	}
}
